﻿using System.Drawing;
using Simple3DRedactor.Domain;

namespace SceneRedactor
{
    class BoxView : GeometryView<Box>
    {
        public BoxView(Box obj) : base(obj)
        {
        }

        public override void ShowProperties(SimpleSceneRedactor redactor)
        {
            base.ShowProperties(redactor);

            redactor.widthTextBox.Text = InnerObject.Width.ToString();
            redactor.heightTextBox.Text = InnerObject.Height.ToString();
            redactor.depthTextBox.Text = InnerObject.Depth.ToString();

            redactor.boxPropertiesGroupBox.Visible = true;
            redactor.boxPropertiesGroupBox.Location = new Point(redactor.specularLabel.Location.X, redactor.specularLabel.Location.Y + 20);
        }

        public override void SaveProperties(SimpleSceneRedactor redactor)
        {
            base.SaveProperties(redactor);

            InnerObject.Width = float.Parse(redactor.widthTextBox.Text);
            InnerObject.Height = float.Parse(redactor.heightTextBox.Text);
            InnerObject.Depth = float.Parse(redactor.depthTextBox.Text);
        }

        public override string ToString()
        {
            return string.Format("{0} [Box]", InnerObject.Name);
        }
    }
}
